package com.haipi.util.mail;

import java.io.Serializable;

import org.apache.log4j.Logger;

public class MailSendTask implements Runnable, Serializable
{

    private static final long serialVersionUID = 1L;

    private static final Logger logger = Logger.getLogger(MailSendTask.class);

    private MailSenderInfo mailSenderInfo;

    public MailSendTask(MailSenderInfo mailSenderInfo)
    {
        this.mailSenderInfo = mailSenderInfo;
    }

    public void run()
    {
        logger.info("begin to send a mail to " + mailSenderInfo.getToAddress());
        
        SimpleMailSender.getInstance().sendTextMail(mailSenderInfo);

        logger.info("end to send a mail to " + mailSenderInfo.getToAddress());
    }

}
